package demo.android.com.mvpdemo.customview.bannerview.imitationSina;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import demo.android.com.mvpdemo.R;

/**
 * Created by Vya on 2018/2/26.
 */

public class CarrouseLayoutAdapter extends BaseAdapter{

    private List<DataBean> mListView;
    private Context mContext;
    public CarrouseLayoutAdapter (List<DataBean> views,Context context){
        this.mListView = views;
        this.mContext = context;
    }
    @Override
    public int getCount() {
        return mListView.size();
    }

    @Override
    public View getView(int position, ViewGroup parent) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.view_sina_item,parent,false);
        ImageView iv = view.findViewById(R.id.iv_pic);
        TextView tv = view.findViewById(R.id.tv_content);
        iv.setImageResource(mListView.get(position).resId);
        tv.setText(mListView.get(position).textContent);
        return view;
    }
}
